using System.Globalization;
using System.Windows.Data;

namespace MinoChat.Converters;

public class TimeDisplayConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is DateTime dateTime)
        {
            if (dateTime.Date == DateTime.Today)
            {
                return $"{dateTime:H点mm分}";
            }
            else
            {
                return $"{dateTime:yyyy-MM-dd}";
            }
        }

        return string.Empty;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
} 